money = 5000000
print("请输入用户名")
name = input()
flag = True



def cha_yu_e():
    print(f"{name},你好，欢迎来到黑马银行，您的余额剩余{money}")
    zhu_caidan()

def cun_qian(i):
    global money
    money += i
    print(f"{name},你好，你存入{i}元成功")
    print(f"{name},你好，你的余额剩余{money}元")
    zhu_caidan()

def qu_qian(i):
    global money
    if money >= i:
        money -= i
        print(f"{name}你好，你取款{i}元成功\n")
        print(f"{name}你好，你的余额剩余{money}元")
def zhu_caidan():
    print(f"{name},你好，欢迎来到黑马银行ATM，请选择操作")
    print("查询余额，\t请按1")
    print("存款，   \t请按2")
    print("取钱，   \t请按3")
    print("退出，   \t请按4")
    b = input()
    if b == "1":
        cha_yu_e()
    elif b =="2":
        print("请输入你要存款的金额")
        i = int(input())
        cun_qian(i)
    elif b =="3":
        print("请输入你要取款的金额")
        i = int(input())
        qu_qian(i)
    elif b =="4":
        print("感谢使用，祝你生活愉快")
        global flag
        flag = False
    else:
        print("输入错误")
        flag = False
while flag:
    zhu_caidan()